<?php
/**
 * @package		Joomla.Site
 * @subpackage	mod_search
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;
$app = & JFactory::getApplication();
$template = $app->getTemplate();
?>
<?php                        	       
$input_name = JText::_( 'Indtast din begivenhed' );
$input_quantity = JText::_( 'Indtast din antal gæster' );
$input_address = JText::_( 'Indtast din addresse' );
$input_postcode = JText::_( 'Indtast din post nr' );
$input_city = JText::_( 'Indtast din by' );
$input_date = JText::_( 'Indtast din dato &amp; tidspunkt' );
?>                        
 <script type="text/javascript">                   
jQuery(document).ready(function(jQuery) {
	jQuery.validator.addMethod('postalcode', function (value) { 
		if(value=='') return true;	
		return /^\d{4}$/.test(value); 
	   }, '');
	
		
		jQuery("#f-searchjob").validate(
			{
				errorPlacement: function(error, element) {			
			},
			invalidHandler: function(form, validator) {
			  var errors = validator.numberOfInvalids();
			if (errors) {
                //$('#alert').html(validator['errorList'][0]['message']);
				jQuery('#alert').html(validator['errorList'][0]['message']);
    			jQuery('#backoverlay').show();
    			jQuery('#show_popup').show();
            	jQuery('#f_focus').html(validator['errorList'][0]['element'].name);
				validator['errorList'][0]['element'].focus();
				
			  } else {
			  }
			},
			rules: {
							
				postcode:{
					digits: true,
					postalcode:true,
				},
				
				quantity: {
					digits:true,
				},
				
				
				
			},
			messages: {
				postcode: "<?php echo $input_postcode; ?>",
				quantity: "<?php echo $input_quantity; ?>",
			}
		});
	});
</script>
<h1>FIND KOK / CATERING FIRMA</h1>
<form action="index.php" name="f-searchjob" id="f-searchjob" method="post">
  <fieldset>
	<div>
	  <label>BEGIVENHED</label>
	  <br>
	  <input id="eventname" name="eventname" type="text" value="">
	</div>
	<div class="w76">
	  <label>POST NR</label>
	  <br>
	  <input id="postcode" name="postcode" class="pn" type="text" value="">
	</div>
	<div class="w163">
	  <label>BY</label>
	  <br>
	  <input id="city" name="city" class="by" type="text" value="">
	</div>
	<div>
	  <label>ANTAL GÆSTER</label>
	  <br>
	  <input id="quantity" name="quantity"  type="text" value="">
	</div>
	<div>
	  <label>DATO &amp; TIDSPUNKT</label>
	  <br>
	  <input id="datepicker" name="datepicker" style="background: url(templates/<?php echo $template; ?>/images/bg-input-datapicker.png) no-repeat right; width: 235px; cursor: pointer; " type="text" value="" >
	</div>
	<div class="bnt-search"> <a href="#" onclick="jQuery('#f-searchjob').submit();" >SØG</a> </div>
  </fieldset>
  <input type="hidden" name="option" value="com_jobs" />
  <input type="hidden" name="task" value="search" />
  <?php echo JHtml::_('form.token'); ?>   
</form>
